package com.framework.repository;

import com.framework.dto.PageRequestDTO;
import com.framework.entity.MergeFile;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.UUID;

/**
 * @Description: MergeFile表实体
 * @Author: JamesYao
 * @DateTime: 2024/1/16 23:53
 */
public interface MergeFileRepository extends JpaRepository<MergeFile, UUID>{
    List<MergeFile> findByFileId(String fileId);
    MergeFile findByFileIdAndUserId(String fileId, UUID userId);
    List<MergeFile> findByHash(String hash);
    List<MergeFile> findByUserId(UUID userId);
    void deleteByFileId(String fileId);
    void deleteByUserId(UUID userId);
    List<MergeFile> findByUserIdAndDeletedAtIsNotNull(UUID userId);
    Page<MergeFile> findByUserIdAndDeletedAtIsNotNullOrderByCreatedAtDesc(UUID userId, Pageable pageable);
    List<MergeFile> findByUserIdAndPidAndDeletedAtIsNull(UUID userId, String pid);
    List<MergeFile> findByPid(String pid);
}
